import Vue from 'vue'
import Vuex from 'vuex'
/* import CN from '../lang/cn'
import TW from '../lang/tw' */
// import common from "@/common/common";
// import apiAjax from '../ajax/apiAjax';
Vue.use(Vuex)
//TW ： 繁体中文  CN ： 简体中文
/* let userStatus = false
if (Vue.ls.get(common.tokenKey)) {
    userStatus = true;
} */
export default new Vuex.Store({
    state: {
        /* switchLanguage: "CN",
        userStatus: userStatus, */
        isOpenDialog:true,//公告
        pupVipShow:false,//充值vip
        amount:{},//交易金额
    },
    mutations: {
       /*  //注销登录更改userStatus为false
        updateUserStatus(state) {
            state.userStatus = false
        }, */
        //不打开弹框
        updateOpenDialog(state,parma){
            state.isOpenDialog =parma
        },
        //关闭vip弹框
        updatePupVipShow(state,parma){
            state.pupVipShow =parma
        },
        async getShowAmount(state){//获取价格
            const {data,status_code} = await window.api.getShowAmount()
            if(!status_code){
                 Object.assign(state.amount , data) 
            }
         }
    },
    getters: {
        /* cutLang(state) {
            if (state.switchLanguage === "CN") {
                return CN
            } else if (state.switchLanguage === "TW") {
                return TW
            }
        }, */
        navTitle(){
            const path = window.app.$route.path
            if(path=='/mob/'){
                return '首页'
            }else if(path=='/hot'){
                return "热点"
            }else if(path=='/my'){
                return "我的"
            }else if(path=='/pop'){
                return "支付"
            }
        },
        
    },
    actions: {
        getShowAmount({commit}){
            commit('getShowAmount')
        }

    },
    modules: {}
})
